<?php
include('Student.php');
$students = array();


$first = new Student();
$first->surname = "Doe";
$first->first_name = "John";
$first->add_email('home','john@doe.com');
$first->add_email('work','jdoe@mcdonalds.com');
$first->add_grade(65);
$first->add_grade(75);
$first->add_grade(55);
$first->status= 'freshman';
$students['j123'] = $first;

$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home','albert@braniacs.com');
$second->add_email('work1','a_einstein@bcit.ca');
$second->add_email('work2','albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$second->status= 'freshman';
$students['a456'] = $second;

$third = new Student();
$third->surname = "Xie";
$third->first_name = "Guo feng";
$third->add_email('home','XieGuofeng@qq.com');
$third->add_grade(45);
$third->add_grade(15);
$third->add_grade(97);
$third->status= 'Junior';
$students['b123'] = $third;

$fourth = new Student();
$fourth->surname = "123";
$fourth->first_name = "123";
$fourth->add_email('home','123@qq.com');
$fourth->add_grade(22);
$fourth->add_grade(33);
$fourth->add_grade(44);
$fourth->status= 'Junior';
$students['c123'] = $fourth;

ksort($students);

foreach($students as $student)
echo $student->toString();